package jsu.lipengcheng.trafficnet.controlle;

import jsu.lipengcheng.trafficnet.Util.OssUtil;
import jsu.lipengcheng.trafficnet.common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/common")
public class CommonControlle {
    @Autowired
    private OssUtil ossUtil;

    @PostMapping("/file")
    public Result uplode(MultipartFile file) throws IOException {
        String url = ossUtil.uplod(file);
        return Result.success(url);
    }
}
